
const rong = '/api'

const obj = {
  // 判断是哪个后端的接口
  getTypeByUrl(url){
    if(url.includes(rong)){
      return rong
    }
  },
  // 配置每个后端人员的 接口返回信息
  [rong]: {
    isErrorRes(res){
      return res?.error
    },
    getErrorMsg(res){
      return res.error.desc
    }
  }
}

const config = {

  isErrorRes(res, url){

    let type = obj.getTypeByUrl(url)

    return obj[type].isErrorRes(res)
  },
  getErrorMsg(res, url){

    let type = obj.getTypeByUrl(url)

    return obj[type].getErrorMsg(res)
  }
}

export {
  rong,
  config
}